//
//  Example.m
//  MiniWeChat
//
//  Created by ByteDance on 2025/6/25.
//

#import "JHDataStorageFactory.h"

@interface Example : NSObject
- (void) setup;
@end

@implementation Example

- (void) setup {
    // 创建 UserDefaults 存储
    NSError *error = nil;
    id<JHDataStorage> userDefaultsStorage = [[JHDataStorageFactory sharedFactory] createStorageWithType:@"userDefaults" configuration:nil error:&error];
    
    if (error) {
        NSLog(@"Failed to create storage: %@", error.localizedDescription);
    } else {
        // 保存数据
        NSString *userName = @"John Doe";
        BOOL success = [userDefaultsStorage saveObject:userName forKey:@"userName" error:&error];
        if (success) {
            NSLog(@"Saved successfully");
        } else {
            NSLog(@"Save failed: %@", error.localizedDescription);
        }
    }
}

@end
